# -*- encoding: utf-8 -*-
from openerp.osv import fields,osv

class res_partner(osv.osv):
    _inherit = 'res.partner'
    def default_get(self, cr, uid, fields_list, context=None):
        default = super(res_partner,self).default_get(cr, uid, fields_list, context)
        if not default:
            default = {}
        if context.get('default_supplier',False):
            #供应商菜单进来的,公司默认为空
            default['company_id'] = None
        return default
    
class mrp_bom(osv.osv):
    _inherit = 'mrp.bom'
    _columns={'company_id': fields.many2one('res.company','Company',required=False),}
    _defaults = {
        'company_id': None,
    }  
class product_product(osv.osv):
    _inherit = 'product.product'
    _defaults = {
        'company_id': None,
    }   
class mrp_routing(osv.osv):
    _inherit = 'mrp.routing'
    _defaults = {
        'company_id': None,
    } 
class stock_picking(osv.osv):
    _inherit = 'stock.picking'
    _defaults = {
        'company_id': None,
    }     
class sale_order(osv.osv):
    _inherit = 'sale.order'
    _defaults = {
        'company_id': None,
    }  
class purchase_order(osv.osv):
    _inherit = 'purchase.order'
    _defaults = {
        'company_id': None,
    }       